﻿using SCG.General;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTEngine
{
    public class AngleCorridor : Room
    {
        //constructor
        public AngleCorridor()
            : base()
        {
            UseConnectorPoints = true;
            int height = Globals.RandomIntFromTo(3, 10);
            int width = height + 1;
            Matrix = new CharMatrix(width, height);
            Matrix.Fill(Globals.TERRAIN_WALL);
            int x = 0;
            for (int y = height - 1; y >= 0; y--)
            {
                Matrix.Set(x, y, Globals.TERRAIN_FLOOR);
                Matrix.Set(x + 1, y, Globals.TERRAIN_FLOOR);
                x++;
            }
            if (Globals.Random.NextDouble() > 0.5)
            {
                Matrix = Matrix.InvertHorizontally();
                StartConnector = width - 2;
                EndConnector = 0;
            }
            else
            {
                StartConnector = 0;
                EndConnector = width - 1;
            }
        }

        //clone
        public override Room Clone()
        {
            return new AngleCorridor();
        }

        public override bool IsCorridor
        {
            get
            {
                return true;
            }
        }
    }
}
